package github.javaguide.serviceimpl;

import github.javaguide.User;
import github.javaguide.UserService;
import github.javaguide.annotation.RpcService;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@RpcService(group = "user1", version = "version1")
public class UserServicelmpl implements UserService {

    static {
        System.out.println("UserServicelmpl 被创建");
    }

    @Override
    public User getUsers(int id) throws InterruptedException {
        log.info("getUsers 收到: {}.", id);
        User user = new User("G哥", 23);
        System.out.println("getUsers 开始睡眠" + System.currentTimeMillis() / 1000);
        Thread.sleep(1000);
        System.out.println("getUsers 睡眠结束" + System.currentTimeMillis() / 1000);
        log.info("getUsers 返回: {}.", user);
        return user;
    }
}
